package string06;
/**
 *  public int length():返回此字符串的长度(字符的个数)
 *  public String substring(int beginIndex):从字符串的指定索引开始,一直截取到字符串末尾
 *  public String substring(int beginIndex, int endIndex):截取[beginIndex,endIndex)之间的字符 (包含头不包含尾)
 */
public class Demo {
    public static void main(String[] args) {
        //method01();
        String str = "sajfdf";
        System.out.println(str.substring(2));
        System.out.println(str);//截取之后原字符串长度不变
        System.out.println(str.substring(2,5));
    }

    private static void method01() {
        String str = "abcdef";
        System.out.println(str.length());//length()为字符的长度

        char[] chars = str.toCharArray();
        System.out.println(chars.length);//length为数组的长度
    }
}
